package client_gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionListener;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JButton;
import javax.swing.JTextField;

import client_controllers.CampaignPatternController;
import client_controllers.EmployeeLoginController;
import client_controllers.MarketingEmployeeController;

public class CampaignPatternGUI extends JFrame {
	/**
	 * @class CampaignPatternGUI is used by marketing employees to create new instances for campaigns and link them to the database.
	 */

	private JPanel contentPane;
	private JPanel panel0;
	private JPanel panel1;
	private JPanel panel2;
	private JPanel panel3;
	private JButton next0;
	private JButton next;
	private JButton next2;
	private JButton logout;
	private JButton submit;
	private JButton back;
	private JComboBox product;
	private JComboBox area;
	private JTextField id;
	private JTextField from_age;
	private JTextField to_age;
	private JTextField from_importance;
	private JTextField to_importance;
	private JTextField from_interest;
	private JTextField to_interest;
	private JTextField message;
	private JLabel error;
	private JLabel lblDefineNewId;
	private JLabel error0;
	private JLabel lblDefineMarketSegment;
	

	public CampaignPatternGUI(MarketingEmployeeController mec,EmployeeLoginController elc) {
				
		getContentPane().setLayout(null);
		this.setTitle("Define Campaigne Pattern");
		this.setSize(434, 604);
		setLocationRelativeTo(null);
		contentPane = new JPanel();
		setContentPane(contentPane);
		contentPane.setLayout(null);
		panel1 = new JPanel();
		panel1.setVisible(false);
		panel1.setBounds(0, 116, 424, 104);
		contentPane.add(panel1);
		panel1.setLayout(null);
		JLabel lblSelectItem = new JLabel("Select Item And Press Next");
		lblSelectItem.setForeground(Color.blue);
		lblSelectItem.setBounds(130, 11, 155, 27);
		panel1.add(lblSelectItem);
		product = new JComboBox<String>();
		product.setBounds(130, 42, 142, 20);
		panel1.add(product);
		next = new JButton("Next");
		next.setBounds(153, 73, 89, 23);
		panel1.add(next);
		
		panel2 = new JPanel();
		panel2.setVisible(false);
		panel2.setBounds(0, 219, 424, 222);
		contentPane.add(panel2);
		panel2.setLayout(null);
		
		lblDefineMarketSegment = new JLabel("Define Market Segment");		
		lblDefineMarketSegment.setBounds(136, 0, 135, 25);
		lblDefineMarketSegment.setForeground(Color.blue);
		panel2.add(lblDefineMarketSegment);
		
		JLabel lblFromAge = new JLabel("From Age:");
		lblFromAge.setBounds(20, 30, 71, 14);
		panel2.add(lblFromAge);
		
		from_age = new JTextField();
		from_age.setBounds(90, 27, 38, 20);
		panel2.add(from_age);
		from_age.setColumns(10);
		
		JLabel lblToAge = new JLabel("To Age:");
		lblToAge.setBounds(133, 30, 44, 14);
		panel2.add(lblToAge);
		
		to_age = new JTextField();
		to_age.setBounds(187, 27, 38, 20);
		panel2.add(to_age);
		to_age.setColumns(10);
		
		JLabel lblArea = new JLabel("Area:");
		lblArea.setBounds(20, 55, 38, 20);
		panel2.add(lblArea);
		
		area = new JComboBox();
		area.setBounds(57, 55, 96, 20);
		panel2.add(area);
		
		JLabel lblCustomerImportance = new JLabel("Customer Importance:");
		lblCustomerImportance.setBounds(20, 86, 133, 25);
		panel2.add(lblCustomerImportance);
		
		from_importance = new JTextField();
		from_importance.setBounds(163, 88, 30, 20);
		panel2.add(from_importance);
		from_importance.setColumns(10);
		
		JLabel lblTo = new JLabel("To");
		lblTo.setBounds(208, 88, 17, 20);
		panel2.add(lblTo);
		
		to_importance = new JTextField();
		to_importance.setBounds(241, 88, 30, 20);
		panel2.add(to_importance);
		to_importance.setColumns(10);
		
		JLabel lblInterestLevel = new JLabel("Interest Level:");
		lblInterestLevel.setBounds(20, 122, 89, 25);
		panel2.add(lblInterestLevel);
		
		from_interest = new JTextField();
		from_interest.setBounds(106, 124, 30, 20);
		panel2.add(from_interest);
		from_interest.setColumns(10);
		
		JLabel label = new JLabel("To");
		label.setBounds(146, 124, 30, 20);
		panel2.add(label);
		
		to_interest = new JTextField();
		to_interest.setBounds(195, 124, 30, 20);
		panel2.add(to_interest);
		to_interest.setColumns(10);
		
		next2 = new JButton("Next");
		next2.setBounds(163, 166, 89, 23);
		panel2.add(next2);
		
		error = new JLabel("Missing Fields");
		error.setForeground(Color.red);
		error.setBounds(165, 5, 83, 14);
		error.setVisible(false);
		panel2.add(error);
		
		panel3 = new JPanel();
		panel3.setVisible(false);
		panel3.setBounds(0, 441, 424, 125);
		contentPane.add(panel3);
		panel3.setLayout(null);
		
		JLabel lblMessageToCustomer = new JLabel("Message To Customer:");
		lblMessageToCustomer.setBounds(140, 0, 133, 25);
		lblMessageToCustomer.setForeground(Color.blue);
		panel3.add(lblMessageToCustomer);
		
		message = new JTextField();
		message.setBounds(0, 25, 414, 64);
		panel3.add(message);
		message.setColumns(10);
		
		submit = new JButton("Submit");
		submit.setBounds(157, 102, 89, 23);
		panel3.add(submit);
		
		panel0 = new JPanel();
		panel0.setBounds(0, 0, 424, 118);
		contentPane.add(panel0);
		panel0.setLayout(null);
		logout = new JButton("Logout");
		logout.setBounds(309, 11, 89, 23);
		panel0.add(logout);
		
		back = new JButton("Back");
		back.setBounds(309, 45, 89, 23);
		panel0.add(back);
		
		lblDefineNewId = new JLabel("Define new ID And Press Next");
		lblDefineNewId.setForeground(Color.blue);
		lblDefineNewId.setBounds(118, 13, 181, 19);
		panel0.add(lblDefineNewId);
		
		id = new JTextField();
		id.setBounds(156, 46, 86, 20);
		panel0.add(id);
		id.setColumns(10);
		
		next0 = new JButton("Next");
		next0.setBounds(153, 77, 89, 23);
		panel0.add(next0);
		
		error0 = new JLabel("Missing Fields");
		error0.setForeground(Color.red);
		error0.setVisible(false);
		error0.setBounds(82, 15, 181, 19);
		panel0.add(error0);
        this.setVisible(true);
		
        CampaignPatternController cpc =new CampaignPatternController(this,elc,mec);
	}

	public JButton getSubmit() {
		return submit;
	}


	public void setSubmit(JButton submit) {
		this.submit = submit;
	}


	public JTextField getMessage() {
		return message;
	}


	public JLabel getLblDefineMarketSegment() {
		return lblDefineMarketSegment;
	}


	public void setLblDefineMarketSegment(JLabel lblDefineMarketSegment) {
		this.lblDefineMarketSegment = lblDefineMarketSegment;
	}


	public JLabel getError() {
		return error;
	}


	public void setError(JLabel error) {
		this.error = error;
	}


	public JLabel getError0() {
		return error0;
	}


	public void setError0(JLabel error0) {
		this.error0 = error0;
	}


	public JLabel getLblDefineNewId() {
		return lblDefineNewId;
	}


	public void setLblDefineNewId(JLabel lblDefineNewId) {
		this.lblDefineNewId = lblDefineNewId;
	}


	public JTextField getId() {
		return id;
	}

	public JButton getBack() {
		return back;
	}


	public void setBack(JButton back) {
		this.back = back;
	}


	public JButton getLogout() {
		return logout;
	}
	public JButton getNext0() {
		return next0;
	}

	public JButton getNext() {
		return next;
	}
	
	public JButton getNext2() {
		return next2;
	}
	public JPanel getPanel1() {
		return panel1;
	}
	
	public JPanel getPanel2() {
		return panel2;
	}

	public JPanel getPanel3() {
		return panel3;
	}





	public void setNextLis(ActionListener lis){
		this.getNext().addActionListener(lis);
	}
	public void SetLogoutLis(ActionListener lis){
		this.getLogout().addActionListener(lis);
	}

	public JComboBox getProduct() {
		return product;
	}


	public void setProduct(JComboBox product) {
		this.product = product;
	}


	public JComboBox getArea() {
		return area;
	}


	public void setArea(JComboBox area) {
		this.area = area;
	}
	public void setexittlis(WindowListener lis){
		this.addWindowListener(lis);
	}
	
	public JTextField getFrom_age() {
		return from_age;
	}


	public JTextField getTo_age() {
		return to_age;
	}
	
	public JTextField getFrom_importance() {
		return from_importance;
	}

	public JTextField getTo_importance() {
		return to_importance;
	}

	public JTextField getFrom_interest() {
		return from_interest;
	}

	public JTextField getTo_interest() {
		return to_interest;
	}

}
